<!DOCTYPE html>
<html>
<head>
    <title>储藏间数据管理</title>
<#include "../../common/common.ftl"/>
</head>
<body>
<div class="layui-tab layui-tab-brief" id="selected">
    <div class="layui-fluid" id="list">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-xs12">
                <div class="layui-card">
                    <div class="layui-card">
                        <div class="layui-card-header">
                            安置项目：<span class="jmdf-color-red">${(azProject.projectName)!}</span>
                        </div>
                        <div class="layui-card-body">
                            <form class="layui-form" id="searchForm">
                                <input type="hidden" name="azProjectId" value="${(azProject.id)!}"/>

                                幢号：
                                <div class="layui-inline" style="width: 120px;">
                                    <input class="layui-input" name="search_eq_string_s.buildNum" autocomplete="off">
                                </div>
                                所在楼层：
                                <div class="layui-inline" style="width: 150px;">
                                    <input class="layui-input" name="search_eq_integer_s.floor" autocomplete="off">
                                </div>
                                户号：
                                <div class="layui-inline" style="width: 120px;">
                                    <input class="layui-input" name="search_like_string_s.houseNum" autocomplete="off">
                                </div>
                                选房状态：
                                <div class="layui-inline" style="width: 120px;">
                                    <select name="search_eq_integer_s.houseStatus" id="houseStatusSelect">
                                        <option value="">--请选择--</option>
                                    </select>
                                </div>
                                交房状态：
                                <div class="layui-inline" style="width: 120px;">
                                    <select name="search_eq_integer_s.takeHouseStatus" id="takeHouseStatusSelect">
                                        <option value="">--请选择--</option>
                                    </select>
                                </div>
                                <button class="layui-btn" type="button" id="searchButton"><i
                                        class="layui-icon layui-icon-search"></i>搜索
                                </button>
                            </form>
                            <table id="dataTable" class="layui-table" lay-filter="layFilter"></table>
                            <!--序号-->
                            <script type="text/html" id="indexTpl">
                                {{d.LAY_TABLE_INDEX+1}}
                            </script>
                            <script type="text/html" id="dataTable_toolbar">
                                {{# if(d.houseStatus == 1){ }}
                                <a class="layui-btn layui-btn-xs jmdf-btn-view" lay-event="dataTable_view"><i
                                        class="layui-icon layui-icon-edit"></i>查看</a>
                                {{#  } }}
                                {{# if(d.houseStatus == 2){ }}
                                <a class="layui-btn layui-btn-xs jmdf-btn-edit" lay-event="dataTable_edit"><i
                                        class="layui-icon layui-icon-edit"></i>修改</a>
                                {{#  } }}
                            </script>
                            <!--菜单-->
                            <!-- 表格头部工具栏 -->
                            <script type="text/html" id="toolbar">
                                <div class="layui-btn-container right">
                                    <button lay-event="reload" class="layui-btn layui-btn-sm"><i
                                            class="layui-icon layui-icon-refresh"></i>重载
                                    </button>
                                    <button lay-event="excelButton" class="layui-btn layui-btn-sm"><i
                                            class="layui-icon layui-icon-layim-download"></i>储物间数据导出
                                    </button>
                                </div>
                            </script>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['table', 'form', 'jquery', 'jmdf', 'page', 'laydate', 'element', 'dataDict'], function () {
        var $ = layui.jquery, jmdf = layui.jmdf, page = layui.page, table = layui.table, form = layui.form, laydate = layui.laydate, element = layui.element, dataDict = layui.dataDict;

        form.render();
        dataDict.select("交房状态", "takeHouseStatusSelect", "");
        dataDict.select("房源状态", "houseStatusSelect", "");

        /***********************table表格相关操作 start*************************/
        var tableRenderId = "renderId";
        var tableId = "dataTable";
        var table_layFilter = "layFilter";
        var tableUrl = "loadWyStorageRoomList?azProjectId=${(azProject.id)!}";

        //列项内容
        var cols = [[
            {title: "序号", toolbar: '#indexTpl', type: "numbers", fixed: 'left', align: 'center', width: 60}
            , {field: "houseNum", title: "楼栋户号", align: 'center', minWidth: 150}
            , {field: "buildArea", title: "建筑面积", align: 'center', minWidth: 150}
            , {
                field: "houseStatus", title: "选房状态", align: 'center', minWidth: 100, templet: function (d) {
                return d.houseStatusStr;
            }}
            , {field: "chooseHouseDate", title: "选房时间", align: 'center', minWidth: 100}
            , {
                field: "takeHouseStatus", title: "交房状态", align: 'center', minWidth: 100, templet: function (d) {
                return d.takeHouseStatusStr;
            }}
            , {field: "takeHouseDate", title: "交房时间", align: 'center', minWidth: 100}
            , {field: "buyHousePersonName", title: "产权人", align: 'center', minWidth: 140}
            , {field: "buyHousePersonIdCard", title: "产权人身份证号", align: 'center', minWidth: 180}
            , {field: "buyHousePersonTel", title: "产权人电话", align: 'center', minWidth: 180}
            , {title: '操作', fixed: 'right', align: 'center', toolbar: '#dataTable_toolbar', width: 300}

        ]];
        //table设置项
        var options = {
            elem: '#' + tableId//table列表id值
            , url: tableUrl
            , toolbar: '#toolbar'//自定义工具栏
            , cols: cols
            , id: tableRenderId
            , defaultToolbar: ['filter', 'print']//显示列、打印
            , autoSort: false //禁用前端自动排序。
        };

        //初始表格（含分页设置）
        page.render(options);
        //表格排序
        page.sort(tableId, tableRenderId);
        //刷新当前页方法封装
        page.reload();

        //分页查询（查询条件）
        $("#searchButton").click(function () {
            page.search("searchForm", tableRenderId);
        });


        //头工具栏事件
        table.on('toolbar(' + table_layFilter + ')', function (obj) {
            switch (obj.event) {
                case 'reload':
                    loadData();
                    break;
                case 'excelButton':
                    location.href = 'wyStorageRoomListExcel?' + $("#searchForm").serialize();
                    break;
            }
        });
        table.on("tool(" + table_layFilter + ")", function (obj) {
            var data = obj.data;///获得当前行数据
            var layEvent = obj.event;//获得lay-event对应的值
            var contractId = data["contractId"];
            var storageRoomId = data["storageRoomId"];
            if (layEvent == "dataTable_edit") {
                jmdf.form("wyStorageRoomForm?storageRoomId=" + storageRoomId, "60")
            }
        });

    });
</script>
</body>
</html>